import React,{Component} from 'react';
import { Tabs } from 'antd';
import source from './mobleSource';
import './listMobile.less';
import PropTypes from 'prop-types';
const TabPane = Tabs.TabPane;
const prefix = 'mobile-list';
class ListMobile extends Component{
    render(){
        let defaultActiveKey = this.props.defaultActiveKey;
        let SourceEle = source.map((value,index)=>{
            return(
                <TabPane tab={value.title} key={index}>
                    {
                        value.content.map((children,key)=>{
                            return(
                                <p key={key}>{children}</p>
                            )
                        })
                    }
                    {value.src?<div className={prefix+'-img-container'}><img src={value.src} alt=""/></div>:null}
                </TabPane>
            )
        });
        return(
            <Tabs defaultActiveKey={defaultActiveKey?defaultActiveKey:'0'} onChange={this.callback} className={prefix+"-tab-container"}>
                {SourceEle}
            </Tabs>
        )
    }
};
export default ListMobile;
ListMobile.propTypes = {
    defaultActiveKey:PropTypes.oneOfType([
        PropTypes.string,
        PropTypes.number
    ])
};

